#!/usr/bin/env python
# encoding: utf-8
"""
opcodes.py

Created by Robert Zimmerman on 2011-12-23.
Copyright (c) 2011 Robert Zimmerman. All rights reserved.
"""

NO_OP               = 0
IMPORT              = 1
SYS_CALL            = 2
BREAKPOINT          = 3
PRINT               = 4

PUSH_CLASS          = 5
PUSH_FUNCTION       = 6
PUSH_PROPERTY       = 7

PUSH_VAR            = 11
PUSH_CONST          = 12
POP                 = 13
DUPLICATE           = 14
SWAP                = 15
PUSH_ITER           = 16
POP_ITER            = 17
NEXT_ITER           = 18
IS_A                = 19

PUSH_LOCALS         = 20
POP_LOCALS          = 21
JUMP_TO_OBJECT      = 22
JUMP_IF_TRUE        = 23
JUMP_IF_FALSE       = 24
JUMP                = 25
CALL                = 26
CALL_MEMBER         = 27
RETURN              = 28
CALL_RETURN         = 29

MAKE_LIST           = 31
MAKE_MAP            = 32

CONCATENATE         = 35
SPLIT               = 36
JOIN                = 37
LENGTH              = 38

ADD                 = 41
SUBTRACT            = 42
MULTIPLY            = 43
DIVIDE              = 44
MODULUS             = 45
EXPONENT            = 46

BIT_AND             = 51
BIT_OR              = 52
BIT_XOR             = 53

PUSH_CODE_OBJ       = 55
PUSH_PC_OFFSET      = 56
PUSH_STACK_LENGTH   = 57

STR_CMP             = 61
ORDINAL             = 62
CHARACTER           = 63

EQUALS              = 65
GREATER_THAN        = 66
LESS_THAN           = 67
GREATER_EQUAL       = 68
LESS_EQUAL          = 69

GET_LIST_ITEM       = 71
SET_LIST_ITEM       = 72
GET_LIST_SLICE      = 73
GET_MAP_ITEM        = 75
SET_MAP_ITEM        = 76
GET_STRING_ITEM     = 78
SET_STRING_ITEM     = 79
GET_STRING_SLICE    = 80

ALLOC               = 81
GET_ID              = 82
ID_EQUALS           = 83

HAS_MEMBER          = 91
GET_MEMBER          = 92
SET_MEMBER          = 93

LIST_APPEND         = 101
LIST_EXTEND         = 102
LIST_REMOVE         = 103

FORMAT_INT          = 111
FORMAT_FLOAT        = 112

STOP                = 127


opcodes = {}
_g = dict(globals())
for v in _g:
    if v.upper() == v:
        opcodes[v] = globals()[v]
        
_v = [_a for (_n,_a) in opcodes.iteritems()]
_k = opcodes.keys()
opcodes_rev = dict(zip(_v,_k))
if __name__ == '__main__':
    print opcodes_rev